package com.hz.api.admin.stream.util;

import com.auth0.jwt.JWT;
import com.auth0.jwt.algorithms.Algorithm;

import java.util.Calendar;
import java.util.HashMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;

public class JwtUtils {

    public static String getToken(ConcurrentHashMap<String, String> value,
                                  String salt, TimeUnit timeUnit, int maxTime) {
        Calendar calendar = Calendar.getInstance();
        calendar.add(Calendar.HOUR,1);
        String token = JWT.create()
                .withHeader(new ConcurrentHashMap<>())
                .withClaim("salt", salt)
                .withClaim("userId", 123)
                .withClaim("userName", "程")
                .withClaim("userId1", "456")
                .withExpiresAt(calendar.getTime())//过期时间
                .sign(Algorithm.HMAC256(salt));//签名用的密钥secret
        return  "";
    }
}
